package com.yuanqiworld.vw.domain;

import org.apache.commons.io.IOUtils;
import org.springframework.roo.addon.dod.RooDataOnDemand;

import java.io.IOException;
import java.util.Collection;

@RooDataOnDemand(entity = Message.class)
public class MessageDataOnDemand {
    public static void initDB() throws IOException {
        String json = IOUtils.toString(MessageDataOnDemand.class.getClassLoader().getResourceAsStream("Message.json"));
        Collection<Message> messages = Message.fromJsonArrayToMessages(json);
        for (Message message : messages) {
            message.merge();
        }

    }
}
